﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZhimeiSoft.CharmManager.Server.DAL
{
    public class CustomerDAL_Const
    {
        private static readonly string CUSTOMINFO_COLUMNS_WITHOUT_SALONID = @"CUSTOMID, CNAME,CNICKNAME, CBIRTHDAY, CHEIGHT, CWIGHT,CPHONE1, 
                    CPHONE2, CZIPCODE, CADDRESS, CINDEXCODE, CMAIL, CREGISTERDATE, CANCELDATE, CSTATE, CLASTREGISTERDATE, CLASTCALL, CMEMO";

        private static readonly string CUSTOMINFO_COLUMNS = CUSTOMINFO_COLUMNS_WITHOUT_SALONID + ", SALONID";

        /// <summary>
        /// 插入
        /// </summary>
        public static readonly string SQL_INSERT_CUSTOMINFO = @"INSERT INTO CUSTOMINFO ( CUSTOMID, CNAME, CBIRTHDAY, CHEIGHT, CWIGHT,CPHONE1, 
                    CPHONE2, CZIPCODE, CADDRESS, CINDEXCODE, CMAIL, SALONID, CREGISTERDATE, CANCELDATE, CSTATE, CLASTREGISTERDATE, CLASTCALL, CMEMO, CNICKNAME)
                VALUES (@CUSTOMID,@CNAME,@CBIRTHDAY,@CHEIGHT,@CWIGHT,@CPHONE1,@CPHONE2,@CZIPCODE,@CADDRESS,@CINDEXCODE,@CMAIL,@SALONID,@CREGISTERDATE,@CANCELDATE
                    ,@CSTATE,@CLASTREGISTERDATE,@CLASTCALL,@CMEMO,@CNICKNAME)";

        /// <summary>
        /// 修改
        /// </summary>
        public static readonly string SQL_UPDATE_CUSTOMINFO = @"UPDATE CUSTOMINFO  SET  CNAME = @CNAME 
                ,CBIRTHDAY = @CBIRTHDAY ,CHEIGHT = @CHEIGHT ,CWIGHT = @CWIGHT ,CPHONE1 = @CPHONE1 ,CPHONE2 = @CPHONE2 
                 ,CZIPCODE = @CZIPCODE ,CADDRESS = @CADDRESS ,CINDEXCODE = @CINDEXCODE ,CMAIL = @CMAIL 
                 ,SALONID = SALONID ,CREGISTERDATE = @CREGISTERDATE ,CANCELDATE = @CANCELDATE ,CSTATE = @CSTATE 
                ,CLASTREGISTERDATE = @CLASTREGISTERDATE ,CLASTCALL = @CLASTCALL ,CMEMO = @CMEMO ,CNICKNAME = @CNICKNAME 
                WHERE CUSTOMID = @CUSTOMID";

        /// <summary>
        /// 删除
        /// </summary>
        public static readonly string SQL_DELETE_CUSTOMINFO = @"DELETE FROM CUSTOMINFO WHERE CUSTOMID = @CUSTOMID";
        /// <summary>
        /// 按照状态获取用户信息
        /// </summary>
        public static readonly string SQL_QUERY_CUSTOMINFO_STATE = string.Concat("SELECT ", CUSTOMINFO_COLUMNS_WITHOUT_SALONID, ", A.SALONID, B.SNAME AS SALONNAME FROM CUSTOMINFO A, SALONINFO B WHERE A.SALONID=B.SALONID AND A.CSTATE = @CSTATE");
        /// <summary>
        /// 按照用户ID获取用户信息
        /// </summary>
        public static readonly string SQL_QUERY_CUSTOMINFO_ID = string.Concat("SELECT ", CUSTOMINFO_COLUMNS_WITHOUT_SALONID, ", A.SALONID, B.SNAME AS SALONNAME FROM CUSTOMINFO A, SALONINFO B WHERE A.SALONID=B.SALONID AND A.CUSTOMID = @CUSTOMID");  
    }
}
